<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>YUI Base Page</title>
  <link rel="stylesheet" href="/main.css" type="text/css">
</head>
<body>
<div id="doc" class="yui-t7">
  <div id="hd" role="banner"><h1>There There</h1></div>
  <div id="bd" role="main">
    <div class="yui-g">
      <p>Traverse links in a web page, looking for alternate KML representations and coordinates. A demo application using "where" and "elsewhere" links proposed at <a href="http://code.google.com/p/where-link-relation-type/">http://code.google.com/p/where-link-relation-type/</a>.</p>
      <form id="locate-form" method="post" action="/locate/index">
        <label for="locate:url">URL:</label>
        <input type="text" name="locate:url" size="60" value="{{ c.url or 'http://' }}"/>
        <input type="submit" name="locate:submit" value="Submit"/>
      </form>
    </div>
    
    {% if c.located %}
    <div class="yui-g">
      <h3>Results</h3>
      <h4>Alternate</h4>
      <p>A rel=alternate link to KML is the more direct means of assigning place to a document.</p>
      {% set alt = c.doc.find('alt') %}
      {% if alt %}
        <a href="{{ alt.attrib['href'] }}">{{ alt.attrib['title'] or alt.attrib['href'] }}</a> => <span>{{ alt.find('geoms').text }}</span>
      {% endif %}
      
      <h4>Links where</h4>
      <p>The target of a rel=where link should describe the document's spatial context using maps, directions, or "GeoWeb" markup (KML, etc).</p>
      <ul>
      {% for node in c.doc.findall('where') %}
        {% set node_geoms = node.find('geoms') %}
        {% set alt = node.find('alt') %}
        <li>
          <a href="{{ node.attrib['href'] }}">{{ node.attrib['title'] or node.attrib['href'] }}</a>
          {% if node_geoms %}
            => <span>{{ node_geoms.text }}</span>
          {% elif alt %}
            => <a href="{{ alt.attrib['href'] }}">{{ alt.attrib['title'] or alt.attrib['href'] }}</a>
              => <span>{{ alt.find('geoms').text }}</span>
          {% endif %}
        </li>
        {% endfor %}
      </ul>
      
      <h4>Links elsewhere</h4>
      <p>The target of a rel=elsewhere link should describe other places away from the document's spatial context using maps, directions, or "GeoWeb" markup (KML, etc).</p>
      <ul>
      {% for node in c.doc.findall('elsewhere') %}
        {% set node_geoms = node.find('geoms') %}
        {% set alt = node.find('alt') %}
        <li>
          <a href="{{ node.attrib['href'] }}">{{ node.attrib['title'] or node.attrib['href'] }}</a>
          {% if node_geoms %}
            => <span>{{ node_geoms.text }}</span>
          {% elif alt %}
            => <a href="{{ alt.attrib['href'] }}">{{ alt.attrib['title'] or alt.attrib['href'] }}</a>
              => <span>{{ alt.find('geoms').text }}</span>
          {% endif %}
        </li>
        {% endfor %}
      </ul>
    </div>
  </div>
  {% endif %}
  
  <div id="ft" role="contentinfo"><p>Some rights reserved 2009 by Sean Gillies.</p></div>
</div>
</body>
</html>
